﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using diploma.core.data.subobjects;

namespace diploma.test.GUI
{
    public partial class PropertyForm : Form
    {

        public PropertyForm(long _parent)
        {
            InitializeComponent();
            parent = _parent;
        }

        PropertyValue pVal;
        long parent = -1;
        public PropertyForm(long _parent, PropertyValue val)
        {
            InitializeComponent();
            parent = _parent;
            pVal = val;
            textBox1.Text = pVal.Title;
            textBox2.Text = pVal.Value;
            button1.Text = "update";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "")
            {
                pVal = new PropertyValue(parent, textBox1.Text, textBox2.Text);
                Close();
            }
            else
            {
                MessageBox.Show("fill_text", "object", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        

        public PropertyValue PValue
        {
            get
            {
                return pVal;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
